package com.rybbaby.tss.front.tssMemberReturnPremiumHistory.service.imp;

import com.rybbaby.tss.core.utils.SequenceUtil;
import com.rybbaby.tss.core.web.service.imp.BaseServiceImp;
import com.rybbaby.tss.front.tssMemberReturnPremium.entity.TssMemberReturnPremium;
import com.rybbaby.tss.front.tssMemberReturnPremiumHistory.dao.ITssMemberReturnPremiumHistoryDao;
import com.rybbaby.tss.front.tssMemberReturnPremiumHistory.entity.TssMemberReturnPremiumHistory;
import com.rybbaby.tss.front.tssMemberReturnPremiumHistory.service.ITssMemberReturnPremiumHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * @description 会员退费记录表数据库操作服务实现
 * 
 * @author 雷春琼
 * 
 * @createDate 2017-08-10 上午12:14:02
 */
@Service
@Transactional
public class TssMemberReturnPremiumHistoryServiceImp extends BaseServiceImp<TssMemberReturnPremiumHistory> implements ITssMemberReturnPremiumHistoryService {

    @Autowired
    private ITssMemberReturnPremiumHistoryDao tssMemberReturnPremiumHistoryDao;

    @Override
    public Serializable saveHistory(TssMemberReturnPremium destEntity) {
        TssMemberReturnPremiumHistory tssMemberReturnPremiumHistory = new TssMemberReturnPremiumHistory();
        String uuid = SequenceUtil.getUUID();
        System.out.println(uuid);
        tssMemberReturnPremiumHistory.setId(uuid);
        tssMemberReturnPremiumHistory.setReturnPremiumId(destEntity.getId());
        tssMemberReturnPremiumHistory.setMemberId(destEntity.getMemberId());
        tssMemberReturnPremiumHistory.setClassHour(destEntity.getClassHour());
        tssMemberReturnPremiumHistory.setPackageId(destEntity.getPackageId());
        tssMemberReturnPremiumHistory.setPaymentId(destEntity.getPaymentId());
        tssMemberReturnPremiumHistory.setRemark(destEntity.getRemark());
        tssMemberReturnPremiumHistory.setAmout(destEntity.getAmout());
        tssMemberReturnPremiumHistory.setAdminUserId(destEntity.getAdminUserId());
        tssMemberReturnPremiumHistory.setCreateId(destEntity.getCreateId());
        tssMemberReturnPremiumHistory.setRefundCode(destEntity.getRefundCode());
        tssMemberReturnPremiumHistory.setRefundStatus(destEntity.getRefundStatus());
        tssMemberReturnPremiumHistory.setApprovalRemark(destEntity.getApprovalRemark());
        tssMemberReturnPremiumHistory.setRefundType(destEntity.getRefundType());
        tssMemberReturnPremiumHistory.setCreateTime(destEntity.getCreateTime());
        tssMemberReturnPremiumHistory.setUpdateTime(destEntity.getUpdateTime());
        tssMemberReturnPremiumHistory.setIsDelete(destEntity.getIsDelete());
        tssMemberReturnPremiumHistory.setVersion(destEntity.getVersion());
        Serializable saveId = tssMemberReturnPremiumHistoryDao.save(tssMemberReturnPremiumHistory);
        return saveId;
    }

    @Override
    public List<TssMemberReturnPremiumHistory> findByHistory(String refundId) throws Exception{
        return tssMemberReturnPremiumHistoryDao.findByHistory(refundId);
    }
}
